package com.briup.recognition.service.impl;

import com.briup.recognition.bean.Interface;
import com.briup.recognition.bean.InterfaceExample;
import com.briup.recognition.dao.InterfaceMapper;
import com.briup.recognition.service.IInterfaceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: recognition
 * @description:
 * @author: charles
 * @create: 2021-03-28 15:11
 **/

@Service
public class InterfaceServiceImpl implements IInterfaceService {

    @Resource
    private InterfaceMapper InterfaceMapper;

    @Override
    public List<Interface> query() {
        InterfaceExample example = new InterfaceExample();
        // 条件

        return InterfaceMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(Interface Interface) {
        if(Interface.getId()!=null){
            InterfaceMapper.updateByPrimaryKey(Interface);
        } else {
            InterfaceMapper.insert(Interface);
        }
    }

    @Override
    public void deleteById(long id) {
        InterfaceMapper.deleteByPrimaryKey(id);
    }
}

